package com.pureut.storage.controller;

import com.pureut.storage.service.PublicSelectSysDateChangeService;
import com.sale.common.core.domain.R;
import com.sale.common.core.web.controller.BaseController;
import com.sale.storage.api.dto.SysDateChangeDto;
import com.sale.storage.api.vo.UpdateDateChangeVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 日期变更出库、入库数据查询控制层
 */
@RestController
@RequestMapping("/public-select")
public class PublicSelectSysDateChangeController extends BaseController {

    @Resource
    PublicSelectSysDateChangeService publicSelectSysDateChangeService;

    /**
     * 出库查询
     */
    @GetMapping("/outSelect")
    public R<SysDateChangeDto> outSelect(String documentNumber) {
        return R.ok(publicSelectSysDateChangeService.outSelect(documentNumber));
    }

    /**
     * 入库查询
     */
    @GetMapping("/inSelect")
    public R<SysDateChangeDto> inSelect(String documentNumber) {
        return R.ok(publicSelectSysDateChangeService.inSelect(documentNumber));
    }

    /**
     * 库内查询
     */
    @GetMapping("/kuneSelect")
    public R<SysDateChangeDto> kuneSelect(String documentNumber) {
        return R.ok(publicSelectSysDateChangeService.kuneSelect(documentNumber));
    }

    /**
     * 出库修改
     */
    @PutMapping("/outUpdate")
    public R<?> outUpdate(@RequestBody UpdateDateChangeVo updateDateChangeVo) {
        return toAjax(publicSelectSysDateChangeService.outUpdate(updateDateChangeVo));
    }

    /**
     * 入库修改
     */
    @PutMapping("/inUpdate")
    public R<?> inUpdate(@RequestBody UpdateDateChangeVo updateDateChangeVo) {
        return toAjax(publicSelectSysDateChangeService.inUpdate(updateDateChangeVo));
    }

    /**
     * 库内修改
     */
    @GetMapping("/kuneUpdate")
    public R<?> kuneUpdate(@RequestBody UpdateDateChangeVo updateDateChangeVo) {
        return toAjax(publicSelectSysDateChangeService.kuneUpdate(updateDateChangeVo));
    }
}
